Out Tag - Formatting Dates and Currencies

Objective

To correctly format numerical data in AutoTag-generated documents.

Pre-requisites

Inserting a Tag

Starting Template

For the starting template, we created labels for a Date, Unit Price and Quantity as shown in the picture below, however this tutorial is perfectly doable without this.

Procedure

1. Load the Sample MSSQL Datasource

Load the MSSQL datasource by clicking the bottom half of the "Data Sources" button, and selecting MSSQL. If there is no MSSQL option in the drop down menu, you may select another datasource, or follow the instructions in the "Creating a SQL datasource" tutorial.

Show Me How!

2. Insert Tag for Date

Insert an Out tag, and select the OrderDate row from the "Invoices" View. Notice that when you hover over "OrderDate" a small hint appears that says "DateTime." This is the type of data stored in that field.

Show Me How!

3. Insert Tag for Unit Price

Now insert another out tag for the Unit Price. Bind it to Views > Invoices > UnitPrice. Notice the hint says "Currency" this time.

Show Me How!

4. Insert Tag for Quantity

Insert an out tag and bind it to Views > Invoices > Quantity. This time the hint just says "Int16" which indicates Quantity is just a plain 16-bit integer. We only care that it isn't a currency, date or some other number requiring formatting.

Show Me How!

5. Generate Report

Click Output > DOCX to view the report. Notice that the Date has a rather unusual format. This format would look great in some cases, but we only have a month, day and year provided so the time stamp is unnecessary. Also notice that the unit price is simply displayed as "14" It would look better if it looked like this: "$14.00"

Show Me How!

6. Format the Date

Format the date by selecting its respective tag and then clicking the "Format Data" button on the right side of the AutoTag ribbon. Select "Date" as the category, then select a type. In the video below, we selected "03/14/01" but feel free to select any of them.

Show Me How!

7. Format the Price

We also want to format the Unit Price to display as a currency. Follow the same procedure as the previous step, but select "Currency" as the category. The default settings should be fine but feel free to play with them.

Show Me How!

8. Format the Quantity

You may also want to display the quantity in a decimal form rather than a plain integer. For example, if you charge for a service by the hour and want to print an invoice showing the exact amount of time spent on a service, you may want to show the quantity with 2 decimal places. Do this by selecting "Number" in the Format Data window, then adjust the settings as you see fit.

Show Me How!

9. Generate Final Document

Generate the final document and see the results.

Show Me How!

Quiz Yourself!

Can you format any number as a date?
No. Dates must specifically come from columns with the "datetime" type.
Yes. Dates in SQL work just like dates in Microsoft Excel
Yes. If an integer is used, it corresponds to milliseconds with 0 being the beginning of time.

Congratulations!

You have completed this tutorial. We recommend taking a look at the Out Tag - Displaying Images tutorial next!

close
continue